﻿
#pragma once

#include "ECanvas.h"
#include "EInputListener.h"

namespace Base3D
{
	// 游戏实体类, EGame相当于一个关卡, 有接受输入控制和绘制的功能
	class EGame : public ECanvas, public EInputListener
	{
    private:
	    //pause
	    bool pause;
        void render();
	public:
		EGame();

		// for input listener
		EBool keyPress(EInt key) override;
		EBool keyRelease(EInt key) override;

		//ignore
		EBool mouseButtonDown(EInt mouseButton) override{return true;}
		EBool mouseButtonRelease(EInt mouseButton) override{return true;}
		EBool mouseMove(EInt x, EInt y) override{return true;}
		EBool mouseWheel(EInt delta) override;//{return true;}

		// for canvas listener
		void onPaint() override;
		void update() override;

	protected:
		// 创建场景
		virtual void createScene();
		// 显示相关信息
		void showInfo();

	protected:
		EInt					currentObjectNum;
		EInt					visiblePolygons;

		EBool					showHelp;

		class ECamera			*camera;
		class EMesh				*plane;
		
		class ESceneManager		*scene;
		class EPlayerController	*player;
		class EGameManager		*gameMgr;

		EInt					mLogicX, mLogicZ;
	};
}